home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
manchest.lha
/
MANCHESTER
/
manchester
/
2.2
/
Form-combineWith:.st
< prev
next >
Wrap
Text File
|
1993-07-24
|
2KB
|
63 lines
" NAME Form-combineWith:
AUTHOR manchester
FUNCTION ?
ST-VERSION 2.2
PREREQUISITES
CONFLICTS
DISTRIBUTION world
VERSION 1
DATE 22 Jan 1989"
'From Smalltalk-80, version 2, of April 1, 1983 on 23 January 1987 at 1:10:51 pm'!
!Form methodsFor: 'image manipulation'!
combineWith: aForm
"Creates a new Form from the receiver and aForm, in the style
of the demonstration on Page 386 of the Blue Book. The two forms
must be of the same size."
| xStep yStep sourceBox destBox newForm mask flag |
self extent = aForm extent
ifFalse: [^self error: 'combineWith: form size must be the same'].
sourceBox _ self boundingBox.
xStep _ self extent x.
yStep _ self extent y.
newForm _ Form new extent: (xStep * 5) @ (yStep * 4).
destBox _ newForm boundingBox.
0 to: 3 do: [ :xCount |
0 to: 3 do: [ :yCount |
flag _ false.
(xCount + yCount) = 0 ifTrue: [mask _ Form black.
flag _ true].
(xCount + yCount) = 1 ifTrue: [mask _ Form darkGray.
flag _ true].
(xCount + yCount) = 2 ifTrue: [mask _ Form gray.
flag _ true].
(xCount + yCount) = 3 ifTrue: [mask _ Form lightGray.
flag _ true].
flag ifTrue: [
newForm copyBits: sourceBox
from: self
at: ((xStep * xCount)@(yStep * yCount))
clippingBox: destBox
rule: (Form over)
mask: mask.
newForm copyBits: sourceBox
from: aForm
at: ((xStep * (4 - xCount))@(yStep * (3 - yCount)))
clippingBox: destBox
rule: (Form over)
mask: mask].
]
].
^newForm
"
| tempForm |
tempForm _ Form readFrom: '/usr/r3/appl/PS/goodies/Manchester_goodies/ronnie.form'.
((tempForm shrinkBy: (2@2)) combineWith: ((tempForm shrinkBy: (2@2)) reverse)) display.
"! !